import logging
logging.basicConfig(level=logging.DEBUG, 
                    format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt='%m-%d %H:%M',
                    filename='myapp.log',
                    filemode='w')

console = logging.StreamHandler()
console.setLevel(logging.INFO)

formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
console.setFormatter(formatter)

logging.getLogger('').addHandler(console)

logging.info('jackdaws love my big sphinx of quartz')

logger1 = logging.getLogger('myapp.area1')
logger2 = logging.getLogger('myapp.area1')

logger1.debug('Quick')
logger1.info('How quick')
logger2.warning('warning')
logger2.error('error')
